﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using System.IO;
using ShrinkWrap;
using ShrinkWrap.Minifier;

namespace ShrinkWrap.Test.Minifier
{
    [TestFixture]
    public class JavascriptMinifierFixture : MinifierFixture
    {
        public override String dataFolder { get { return @"Data\Js\"; } }
        public override String fileExtension { get { return "js"; } }

        [TestCase("/* Hello */", "", Description="Minify a comment.")]
        [TestCase("", "", Description="Minify an empty string.")]
        [TestCase("alert('Hello World!');", "\nalert('Hello World!');", Description="Minify an alert() that's already minimal.")]
        public void TestMinifyingString(String input, String expected)
        {
            JavascriptMinifier minifier = new JavascriptMinifier();

            AssertMinificationIsCorrect(expected, input, minifier);
        }

        [TestCase("jquery-1.3.1", Description="Minify JQuery.")]
        [TestCase("mootools-1.2.3-core-nc", Description="Minify MooTools.")]
        public void TestMinifingFile(String filename)
        {
            JavascriptMinifier minifier = new JavascriptMinifier();

            AssertFileMinificationIsCorrect(filename, minifier);
        }
    }
}
